﻿using System;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKCodeBase.Math;
using YJKRevitCode.ElementEditUtility.TextNoteEditUtility;

namespace YJKRevitCode.SampleAndTest
{
	[Transaction(TransactionMode.Manual)]
	public class CmdTextNoteRoate : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			UIApplication application = commandData.Application;
			Application application2 = commandData.Application.Application;
			UIDocument activeUIDocument = application.ActiveUIDocument;
			Document document = activeUIDocument.Document;
			Reference reference = activeUIDocument.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, "选择被旋转的TextNote");
			TextNote inputTextNote = document.GetElement(reference.ElementId) as TextNote;
			double dInputAngle = UnitUtility.AngleToRadian(135.0);
			TextNoteRoateUtility.TryRoateTextNote(inputTextNote, dInputAngle, false, true);
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
